<!DOCTYPE html>
<!--
 Copyright (c) 2017-2018 fortiss GmbH
               2018-2019 Johannes Kepler University Linz
               2019 Andrea Zoitl
               2019 Jan Holzweber
  
 This program and the accompanying materials are made available under the
 terms of the Eclipse Public License 2.0 which is available at
 http://www.eclipse.org/legal/epl-2.0.

 SPDX-License-Identifier: EPL-2.0
 
 Contributors:
   Monika Wanger, Jose Cabral 
     - initial API and implementation and/or initial documentation
   Bianca Wiesmayr
     - minor text corrections
   Andrea Zoitl
     - updated ToC, improved readability
   Virendra Ashiwal
   	 -	remove a extra "(" as typo
     Jan Holzweber - added tutorial Step 7
-->

<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Step 6 - Advanced Features</title>
    <link rel="stylesheet" type="text/css" href="../help.css" />
  </head>
  <body>
  
<!--********************************************************************************************-->

<h1 id="topOfPage">Step 6 - Advanced Features</h1>
    
	<p>This page is part of a guide that gives a walk-through over the major 4diac&nbsp;IDE features.</p>

    <ol start="0">
		<li><a href="../../html/4diacIDE/overview.html">4diac&nbsp;IDE Overview</a></li>
		<li><a href="../../html/4diacIDE/use4diacLocally.html">Use 4diac Locally (Blinking tutorial)</a></li>
		<li><a href="../../html/4diacIDE/distribute4diac.html">Distribute 4diac Applications</a></li>
		<li><a href="../../html/4diacIDE/use4diacRemotely.html">Deploy Applications Remotely</a></li>
		<li><a href="../../html/4diacIDE/createOwnTypes.html">Create Your own Function Block Types</a></li>
		<li><a href="../../html/4diacIDE/otherUseful.html">Other Basic Features</a></li>
		<li>Advanced Features (YOU ARE HERE!)</li>
		<li><a href="../../html/4diacIDE/dynamicTypeLoader.html">Deploying new FBs with the Dynamic Type Loader</a></li>
    </ol>

	<p>This page shows some advanced features about 4diac&nbsp;IDE that are usually used in more complicated applications:</p>

	<ol>
  		<li><a href="#adaptersUsage">Adapter Usage</a></li>
 		<li>Subapplications (implemented since version 1.9)</li>
	</ol>

<!--********************************************************************************************-->

<h2 id="adaptersUsage">Adapter Usage</h2>

	<p><span class="element61499">Adapters</span> group interface elements into reusable interface descriptions. 
	They reduce the number of interface elements (event and data inputs and outputs) and by that the number of connections that have to be created between interacting function blocks. 
	In 4diac&nbsp;IDE, <span class="element61499">adapters</span> are listed in the type library and represented by this symbol: <img class="inlineImg" src="../../html/4diacIDE/img/adapter/adapter.png" alt="adapter" />.</p>

<!--********************-->

<h3 id="newAdapterType">Create a new Adapter Type</h3>
	<p>These interface descriptions can be added to the interface of any Function Block Type.
	Currently, <span class="element61499">adapters</span> can not contain other adapters.
	There are two types of <span class="element61499">adapters</span>, which are mirrored interfaces:</p>

	<img class="center" src="../../html/4diacIDE/img/adapter/plugAndSocket.png" alt="socket and plug."/>

	<ul>
  		<li><span class="element61499">socket</span>: added as <span class="element4diac">input</span> of a function block and represented by this symbol <img class="inlineImg" src="../../html/4diacIDE/img/adapter/sockets_16.png" alt="socket of adapter" /> within the function block's interface.</li>
  		<li><span class="element61499">plug</span>: added as <span class="element4diac">output</span> of a function block and represented by this symbol <img class="inlineImg" src="../../html/4diacIDE/img/adapter/plugs_16.png" alt="plug of adapter" /> within the function block's interface.</li>
	</ul>

	<p>When a new <span class="element61499">adapter</span> is created, it should be a <span class="element4diac">socket</span>. 
	The mirrored plug is derived automatically by 4diac&nbsp;IDE and is <span class="specificText">NOT</span> created by the user.
	An adapter (socket) is created by <span class="command4diac">File &rarr; New &rarr; New Type</span> and selecting <span class="menu4diac">Adapter.adp</span> as Type.
	All adapter names should start with an <span class="specificText">A</span> (naming convention).</p>

	<img class="center" src="../../html/4diacIDE/img/adapter/newAdapter.png" alt="socket creation."/>

<!--********************-->

<h3 id="useAdapterType">Use Your new Adapter Type</h3>
	<p>After creating your desired adapter type (socket), it can be added to a function block's interface by drag and drop from the Palette, as illustrated in the following figure.</p>

	<img class="center" src="../../html/4diacIDE/img/adapter/addAdapter.png" alt="add adapter to the interface of a function block."/>

	<p>The function blocks used within the following application snippet are part of the TrafficLight example system. 
	Two different adapter types have been used, <span class="element4diac">ATimeOut</span> in <span class="element4diac">PedLightCtl_AT</span> and <span class="element4diac">E_TimeOut</span> and <span class="element4diac">ATrafficLight</span> in <span class="element4diac">PedLightCtl_AT</span>.</p>

	<p>The <span class="element4diac">PedLightCtl_AT</span> is a basic function block. Within basic function blocks adapters are accessed by <span class="specificText">FB_INTERFACE_NAME.ADAPTER_INTERFACE_NAME</span>. 
	The elements of the <span class="element4diac">ATimeOut</span> adapter are therefore accessed by <span class="specificText">timeOut.START</span>, <span class="specificText">timeOut.STOP</span> and <span class="specificText">timeOut.TimeOut</span>.</p>

	<p>The <span class="element4diac">E_TimeOut</span> is a composite function block. 
	Within the network of a composite function block, any adapter added to its interface is represented by an adapter block which looks like a Function Block. 
	The interface elements of this adapter block are connected like a function block.</p>

	<img class="center" src="../../html/4diacIDE/img/adapter/example.png" alt="application with function blocks that contain adapters."/>

	<p>Further examples for the usage of adapters can be found within the FestoMPS example system.<p>

<!--********************************************************************************************-->

<h1>Where to go from here?</h1>

<p>If you want to see some examples, behind the following link is an index of the available examples in the documentation:</p>

<p><a href="../../html/examples/examplesIndex.html">4diac Examples</a></p>

<p>If you have a specific platform that has input and outputs and is supported by 4diac&nbsp;FORTE, for example a Raspberry Pi or a PLC, and you want to use them, go to following page:</p>

<p><a href="../../html/parameters/parameters.html">Parameters for Different Platforms</a></p>

<p>If you want to use a specific communication protocol supported by 4diac&nbsp;FORTE, for example MQTT, OPC UA, Modbus and so on, go this page:</p>

<p><a href="../../html/communication/communicationIndex.html">Supported Communication Protocols</a></p>

<p>If you want to go back to see again the basic features, here's a link:</p>

<p><a href="../../html/4diacIDE/otherUseful.html">Step 5 - Other Basic Features</a></p>

<p>If you want to go back to the Start Here page, we leave you here a fast access:</p>

<p><a href="../../html/startHere/startHere.html">Where to Start</a></p>

<p class="goToTop"><a href="#topOfPage">Go to top</a></p>

</body>
</html>


